home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / gamesmaster / includes / games / games.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-13  |  10.5 KB  |  319 lines

  1. #ifndef GAMES_GMS_H
  2. #define GAMES_GMS_H TRUE
  3.  
  4. /*
  5. **    $VER: games.h 0.3 (08.09.96)
  6. **    Includes Release xx.xx
  7. **
  8. **    General include file for programs using the Games Master System.
  9. **
  10. **    (C) Copyright 1996 DreamWorld Productions.
  11. **        All Rights Reserved
  12. */
  13.  
  14. #ifndef EXEC_TYPES_H
  15. #include <exec/types.h>
  16. #endif
  17.  
  18. #ifndef GMS_SOUND_H
  19. #include <games/sound.h>
  20. #endif
  21.  
  22. #define FILTER_OFF  0
  23. #define FILTER_ON   1
  24.  
  25. #define LISTSTART   "LIST"
  26. #define LISTEND     0
  27. #define ENDLIST     0
  28.  
  29. /*
  30. ** --- Universal joystick status bits returned from Read_Joystick, Sega,
  31. **     JoyPad, etc...
  32. */
  33.  
  34. #define JT_SWITCH 0
  35. #define JT_ZBXY   1
  36.  
  37. #define JS_LEFT   (1L<<0)          /* X axis */
  38. #define JS_RIGHT  (1L<<1)
  39. #define JS_UP     (1L<<2)          /* Y axis */
  40. #define JS_DOWN   (1L<<3)
  41. #define JS_ZIN    (1L<<4)          /* Z axis!  Reserved for later... */
  42. #define JS_ZOUT   (1L<<5)
  43. #define JS_FIRE1  (1L<<6)          /* Fire Buttons */
  44. #define JS_FIRE2  (1L<<7)          /* <-For 2 button joysticks */
  45.  
  46. #define JS_RED    (1L<<6)
  47. #define JS_BLUE   (1L<<7)
  48. #define JS_PLAY   (1L<<8)          /* CD32 buttons here */
  49. #define JS_RWD    (1L<<9)
  50. #define JS_FFW    (1L<<10)
  51. #define JS_GREEN  (1L<<11)
  52. #define JS_YELLOW (1L<<12)
  53.  
  54. #define JB_FIRE1  (1L<<16)         /* For the ZBXY style return type */
  55. #define JB_FIRE2  (1L<<17)         /*  (analog joysticks) */
  56.  
  57. #define MB_LMB    (1L<<16)         /* Mouse button flags returned from */
  58. #define MB_RMB    (1L<<17)         /*  Read_Mouse(), in ZBXY format */
  59. #define MB_MMB    (1L<<18)
  60.  
  61. /* --- Joyport specifications for calling Read_JoyStick/Mouse/JoyPad...() */
  62.  
  63. #define JPORT1    0*2
  64. #define JPORT2    1*2
  65. #define JPORT3    2*2
  66. #define JPORT4    3*2
  67.  
  68. /* --- Raster/Copper commands for RasterLists.
  69. **
  70. **     Example of initialising a 24 bit colourlist:
  71. **
  72. **     LONG RasterList[] = {
  73. **          COL24LIST(0,1,0,&ColourList),
  74. **          RASTEND
  75. **     };
  76. **
  77. ** COL12      (ColourNumber,0xRGB)
  78. ** COL24      (ColourNumber,0xRRGGBB)
  79. ** COL12LIST  (StartLine,Skip,Colour,(&ColourList)
  80. ** COL24LIST  (StartLine,SKip,Colour,(&ColourList)
  81. ** SPRITE     (SpriteStruct)
  82. ** SCROLL     (Fields,PixelOffset0-16,PixelQuarterOffset 1-4)
  83. ** FLOOD      
  84. ** REPOINT    (&BitplanePtr)
  85. ** MIRROR     
  86. ** NEWPALETTE (ColStart,AmtCols,&Palette)
  87. ** WAITLINE   (Line)
  88. ** RASTEND
  89. **
  90. ** Warn: With colour related commands you must use the same amount of colour
  91. ** bits as specified in your GameScreen structure (_12BITCOL or _24BITCOL)
  92. */
  93.  
  94. #define COL12(a,b)         (00<<16)|a,(b<<16),0
  95. #define COL24(a,b)         (02<<16)|a,b,0
  96. #define COL12LIST(a,b,c,d) (04<<16)|a,(b<<16)|c,d,0
  97. #define COL24LIST(a,b,c,d) (06<<16)|a,(b<<16)|c,(LONG)(d),0
  98. #define SPRITE(a)          (08<<16),(a<<16),0
  99. #define SCROLL(a,b,c)      (10<<16)|a,(b<<16)|c,0
  100. #define FSCROLL(a,b,c,d)   (12<<16)|a,(b<<16)|c,(d<<16),0
  101. #define FLOOD              (14<<16),0
  102. #define REPOINT(a)         (16<<16),(LONG)(a),0
  103. #define MIRROR             (18<<16),0
  104. #define NEWPALETTE(a,b,c)  (20<<16)|a,(b<<16),(LONG)(c),0
  105. #define WAITLINE(a)        (22<<16)|a,0
  106. #define RASTEND            0xffffffff
  107.  
  108. /* --- GPI ID numbers --- */
  109.  
  110. #define GPI_SCREENS  0
  111. #define GPI_BLITTER  4
  112. #define GPI_SOUND    8
  113. #define GPI_NETWORK  12
  114. #define GPI_VECTORS  16
  115. #define GPI_DEBUG    20
  116. #define GPI_ANIM     24
  117. #define GPI_REKO     28
  118. #define GPI_TEXT     32
  119.  
  120. /* --- Standard screen structure --- */
  121.  
  122. #define GSV1 'G','S','V','1',0
  123.  
  124.   struct   GameScreen
  125.     {
  126.     char   VERSION[4];           /* Structure version - "GSV1" */
  127.     APTR   Stats;                /* Private */
  128.     APTR   MemPtr1;              /* Ptr to screen 1 */
  129.     APTR   MemPtr2;              /* Ptr to screen 2 (double buffer) */
  130.     APTR   MemPtr3;              /* Ptr to screen 3 (triple buffer) */
  131.     APTR   ScreenLink;           /* Ptr to a linked screen */
  132.     APTR   Palette;              /* Ptr to the screen palette */
  133.     APTR   RasterList;           /* Ptr to a rasterlist */
  134.     ULONG  AmtColours;           /* The amount of colours in the palette. */
  135.     UWORD  ScrWidth;             /* The width of the visible screen */
  136.     UWORD  ScrHeight;            /* The height of the visible screen */
  137.     UWORD  PicWidth;             /* The width of the entire screen */
  138.     UWORD  PicHeight;            /* The height of the entire screen */
  139.     UWORD  Planes;               /* The amount of planes in da screen */
  140.     WORD   ScrXOffset;           /* Hardware co-ordinate for TOS */
  141.     WORD   ScrYOffset;           /* Hardware co-ordinate for LOS */
  142.     WORD   PicXOffset;           /* Offset of the horizontal axis */
  143.     WORD   PicYOffset;           /* Offset of the vertical axis */
  144.     ULONG  ScrAttrib;            /* Special Attributes are? */
  145.     UWORD  ScrMode;              /* What screen mode is it? */
  146.     UBYTE  ScrType;              /* Interleaved/Planar/Chunky? */
  147.     UBYTE  Displayed;            /* Private */
  148.     };
  149.  
  150. /* SCREEN TYPES (flags for SS_ScrType) */
  151.  
  152. #define INTERLEAVED  0              /* These are actual numbers */
  153. #define PLANAR       1              /* rather than bits */
  154. #define CHUNKY       2
  155.  
  156. /* SCREEN ATTRIBUTES (flags and bits for SS_ScrAttrib) */
  157.  
  158. #define DBLBUFFER  0x00000001       /* For double buffering */
  159. #define TPLBUFFER  0x00000002       /* Triple buffering!! */
  160. #define PLAYFIELD  0x00000004       /* Set if it's part of a playfield */
  161. #define HSCROLL    0x00000008       /* Gotta set this to do scrolling */
  162. #define VSCROLL    0x00000010       /* For vertical scrolling */
  163. #define SPRITES    0x00000020       /* Set this if you want sprites */
  164. #define HBUFFER    0x00000040       /* Create a buffer for horiz scrolling */
  165. /*                 0x00000080       */
  166. #define BLKBDR     0x00000100       /* Gives a blackborder on AGA machines */
  167. #define NOSPRBDR   0x00000200       /* For putting sprites in the border */
  168.  
  169. /* SCREEN MODES (flags for SS_ScrMode) */
  170.  
  171. #define LORES      0x0000           /* Low resolution (default) */
  172. #define HIRES      0x0001           /* High resolution */
  173. #define SHIRES     0x0002           /* Super-High resolution */
  174. #define INTERLACED 0x0004           /* Interlaced */
  175. #define EXTRAHB    0x0010           /* Extra Half-Brite */
  176. #define NTSC       0x0020           /* Set if you wrote this game in NTSC */
  177. #define HAM        0x0040           /* For HAM mode */
  178. #define COL24BIT   0x0080           /* 24Bit colours (default is 12Bits) */
  179.  
  180. /* --- Universal errorcodes returned by certain functions --- */
  181.  
  182. #define ERR_OK     0           /* Function went OK (also NULL) */
  183. #define ERR_NOMEM  1           /* Not enough memory available */
  184. #define ERR_NOPTR  2           /* Required pointer not present */
  185. #define ERR_INUSE  3           /* Previous allocations have not been freed */
  186. #define ERR_NOVER  4           /* Structure version not supported or not found */
  187. #define ERR_FAILED 5           /* General failure */
  188. #define ERR_FILE   6           /* File error, eg file not found */
  189.  
  190. /* --- Sprite structure --- */
  191.  
  192. #define SPV1 'S','P','V','1',0
  193.  
  194.   struct Sprite
  195.    {
  196.    char  VERSION[4];
  197.    APTR  Stats;
  198.    UWORD Number;         /* Bank number to access */
  199.    APTR  Data;           /* Pointer to Sprite graphic */
  200.    WORD  XPos;           /* X position */
  201.    WORD  YPos;           /* Y position */
  202.    UWORD Frame;          /* Frame number */
  203.    UWORD Width;          /* Width in pixels */
  204.    UWORD Height;         /* Height in pixels */
  205.    UWORD AmtColours;     /* 4 or 16 */
  206.    UWORD ColStart;       /* Colour bank to access, increments of 16 */
  207.    UWORD Planes;         /* Amount of planes per bank */
  208.    UWORD Resolution;     /* HiRes/LoRes/SHiRes/XLONG */
  209.    UWORD FieldPriority;  /* Field position in relation to playfields */
  210.    ULONG SpriteSize;     /* Reserved */
  211.    ULONG FrameSize;      /* Reserved */
  212.    };
  213.  
  214. #define SPR_OCS 0x0010
  215. #define SPR_AGA 0x0020
  216. #define XLONG   0x0040
  217.  
  218. /* --- The picture structure for loading and depacking of pictures */
  219.  
  220. #define PCV1 'P','C','V','1',0
  221.  
  222.   struct Picture
  223.    {
  224.    char  VERSION[4];        /* "PCV1" */
  225.    APTR  Stats;             /* Reserved */
  226.    APTR  Data;              /* Destination or Source */
  227.    UWORD Width;             /* Width */
  228.    UWORD Height;            /* Height */
  229.    UWORD Planes;            /* Amount of planes */
  230.    ULONG AmtColours;        /* Amount of colours */
  231.    APTR  Palette;           /* Original palette */
  232.    UWORD ScrMode;           /* Intended screen mode for picture */
  233.    UWORD Type;              /* Interleaved/Chunky/Planar */
  234.    ULONG Attrib;            /* GETPALETTE/VIDEOMEM/ */
  235.    };
  236.  
  237. /* --- Choose one of these for calling Set_Interrupt() --- */
  238.  
  239. #define INTB_INTEN   14   /* Master interrupt (enable only ) */
  240. #define INTB_EXTER   13   /* External interrupt */
  241. #define INTB_DSKSYNC 12   /* Disk re-SYNChronized */
  242. #define INTB_RBF     11   /* serial port Receive Buffer Full */
  243. #define INTB_AUD3    10   /* Audio channel 3 block finished */
  244. #define INTB_AUD2     9   /* Audio channel 2 block finished */
  245. #define INTB_AUD1     8   /* Audio channel 1 block finished */
  246. #define INTB_AUD0     7   /* Audio channel 0 block finished */
  247. #define INTB_BLIT     6   /* Blitter finished */
  248. #define INTB_VERTB    5   /* start of Vertical Blank */
  249. #define INTB_COPER    4   /* Coprocessor */
  250. #define INTB_PORTS    3   /* I/O Ports and timers */
  251. #define INTB_SOFTINT  2   /* software interrupt rest */
  252. #define INTB_DSKBLK   1   /* Disk Block done */
  253. #define INTB_TBE      0   /* serial port Transmit Buffer Empty */
  254.  
  255. /* --- Special Keypresses that can be returned from Read_Key().  All other
  256. ** keys can be considered to be in ASCII format.
  257. */
  258.  
  259.  struct Keys
  260.   {
  261.   WORD  KP_ID;
  262.   BYTE  KP_Key1;
  263.   BYTE  KP_Key2;
  264.   BYTE  KP_Key3;
  265.   BYTE  KP_Key4;
  266.   };
  267.  
  268. #define K_SCS     0x80       /* Screen switch (LEFTAMIGA + M) */
  269. #define K_DEL     0x81
  270. #define K_HELP    0x82
  271.  
  272. #define K_LSHIFT  0x83
  273. #define K_RSHIFT  0x84
  274. #define K_CAPS    0x85
  275. #define K_CTRL    0x86
  276. #define K_LALT    0x87
  277. #define K_RALT    0x88
  278. #define K_LAMIGA  0x89
  279. #define K_RAMIGA  0x8a
  280.  
  281. #define K_F1      0x8b
  282. #define K_F2      0x8c
  283. #define K_F3      0x8d
  284. #define K_F4      0x8e
  285. #define K_F5      0x8f
  286. #define K_F6      0x90
  287. #define K_F7      0x91
  288. #define K_F8      0x92
  289. #define K_F9      0x93
  290. #define K_F10     0x94
  291. #define K_F11     0x95
  292. #define K_F12     0x96
  293. #define K_F13     0x97
  294. #define K_F14     0x98
  295. #define K_F15     0x99
  296. #define K_F16     0x9a
  297. #define K_F17     0x9b
  298. #define K_F18     0x9c
  299. #define K_F19     0x9d
  300. #define K_F20     0x9e
  301.  
  302. #define C_UP      0x9f
  303. #define C_DOWN    0xa0
  304. #define C_RIGHT   0xa1
  305. #define C_LEFT    0xa2
  306.  
  307. #define K_SRIGHT  0xa3       /* Special key on right */
  308. #define K_SLEFT   0xa4       /* Special key on left */
  309.  
  310. /* --- Special keys that are recognised under ASCII (here for convenience)*/
  311.  
  312. #define K_BAKSPC 08
  313. #define K_TAB    09
  314. #define K_ENTER  10
  315. #define K_RETURN 10
  316. #define K_ESC    ""
  317.  
  318. #endif
  319.